﻿using Hidistro.Core;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;
using wnxd.product;

namespace Hidistro.UI.SaleSystem.Tags
{
    public class wnxd_VShop_DefaulProduct : WebControl
    {
        protected override void Render(HtmlTextWriter writer)
        {
            DataRow row;
            wnxd_product wnxd_product = new wnxd_product();
            if (this.index == 0)
            {
                row = wnxd_product.TagGetProduct(this.categoryid, 11);
            }
            else
            {
                row = wnxd_product.TagGetProduct(this.categoryid, 12, this.index);
            }
            StringBuilder builder = new StringBuilder();
            if (row != null)
            {
                builder.AppendFormat("<a href=\"{0}\">", Globals.ApplicationPath + "/Vshop/ProductDetails.aspx?ProductId=" + row["ProductId"]);
                builder.AppendFormat("<img src=\"{0}\"/>", Globals.GetImgUrl(row["ImageUrl9"].ToString()));
                builder.Append("<div class=\"info\">");
                //builder.AppendFormat("<div class=\"name bcolor\">{0}</div>", row["ProductName"]);
                builder.AppendFormat("<div class=\"price font-s text-danger\">￥{0}</div>", Globals.FormatMoney((decimal)row["MarketPrice"]));
                //builder.AppendFormat("<div class=\"sales text-muted font-xs\">已售{0}件</div>", row["ShowSaleCounts"]);
                builder.Append("</div></a>");
            }
            writer.Write(builder.ToString());
        }
        public int index { get; set; }

        public int categoryid { get; set; }
    }
}
